define([
        'app/utils/WebUtils',
        'app/service/GeneralServices',
        'underscore',
        'app/utils/AMUIPaginationUtils',
        'app/utils/AMUICookieUtils',
        'app/utils/CommonUtils'
        
        
        ], function (
        WebUtils,
        gs,
        _,
        AMUIPaginationUtils,
        AMUICookieUtils
    ) {
	
	var opt ={};
	var p1 = {};
	
	opt = p1 = AMUICookieUtils.initializePage(true);
	
	p1.s=$.getUrlParam("s");
	p1.p=$.getUrlParam("p");
	p1.w=$.unicodeToHanzi($.getUrlParam("w"));
	
	$("#wjt_search_input").val(p1.w);
	
	gs.wjt_admin_member_init(p1, function(resp){
		if(resp.status == "500"){
			WebUtils.alert("连接错误，请刷新页面重试！");	
			return;
		}
		
		opt.useruuid = p1.useruuid;
		
		opt.navi_main = "用户管理";
		opt.navi_sub = "管理平台中的用户信息"
		
		opt.copyrighttext = resp.result.admin_copyright;//"© 2016 版权所有 中研沃兮网络科技（上海）有限公司";
		WebUtils.inputInt($("#wjt-admin-copyright"), opt.copyrighttext);
		
		WebUtils.adminPageInt(opt);
		
		$(".wjt-admin-list").html("");
		
		for(var i = 0; i < resp.result.users.length; i++){
			var item = resp.result.users[i];
			var _pwd = "无";
			if(!$.isNullStr(item.pwd)){
				_pwd = item.pwd;
			}
			
			var el = $(
					'<tr>'+
		            '<td>'+$.val_trim(item.name)+'</td>'+
		            '<td>'+$.val_trim(item.email)+'</td> '+
		            '<td>'+$.val_trim(item.tel)+'</td> '+
		            '<td>'+$.timeFormat1(item.createtime)+'</td> '+
		            '<td>'+
		              '<div class="am-dropdown" data-am-dropdown="">'+
		                '<button class="am-btn am-btn-default am-btn-xs am-dropdown-toggle" data-am-dropdown-toggle=""><span class="am-icon-cog"></span> <span class="am-icon-caret-down"></span></button>'+
		                '<ul class="am-dropdown-content">'+
		                  '<li><a href="admin-userdetails.html?useruuid='+item.uuid+'">编辑／完善信息</a></li>'+
		                '</ul>'+
		              '</div>'+
		            '</td>'+
		          '</tr>');
			$(".wjt-admin-list").append(el);
		}
		
		//下拉栏
		$('.am-dropdown').dropdown();
		//弹出框
		$('.wjt-am-popover').popover();
		
		//初始化pagination
		if(resp.result.total <= $.paginationDefaultSize){
			var page_total = 1;	
		}else{
			var page_total = parseInt((resp.result.total-1)/$.paginationDefaultSize) + 1; 
		}
		AMUIPaginationUtils.init($(".wjt-pagination-container"), page_total, resp.result.current, 
			function(page){
				$.urlSearch($("#wjt_search_input").val(),page);
			}
		);
		
	});
	
	
	$(".wjt-search-btn").click(function(){
		
		$.urlSearch($("#wjt_search_input").val(),1);
		
	});
	
	return;
});